/*
 * @Author: TT-hzy
 * @Date: 2024-07-26 15:09:44
 * @LastEditors: TT-hzy
 * @LastEditTime: 2024-07-26 15:27:06
 */
/*
 * @Author: TT-hzy 
 * @Date: 2024-06-01 18:21:38
 * @LastEditors: TT-hzy 
 * @LastEditTime: 2024-06-13 10:24:49
 * @Description: 
 */

import 'dart:math';

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'package:hzy_normal_tool/hzy_normal_tool.dart';
import 'package:hzy_project_template/base_ui_config/common_layout_less_widget.dart';
import 'package:hzy_project_template/config/data_config/data_config_index.dart';

import '../config/launch_config/launch_id_config.dart';
import 'anims/crystal_showflake_animation.dart';
import 'anims/water_ripple_animation.dart';

class NormalLikeEmptyWidget extends CommoLayoutLessWidget {
  NormalLikeEmptyWidget({
    super.key,
    this.tapCall,
  });
  final GestureTapCallback? tapCall;
  final int randNum = Random().nextInt(10000);
  final double btnW = 80;
  final Color themeColor = getColorFromHex("FF464F");
  final int count = 6;
  @override
  Widget createBody({
    required BuildContext context,
    BoxConstraints? constraints,
  }) {
    Widget body = createEmptyBtn();
    body = CrystalSnowflakeAnimation(
      child: body,
    );

    return body;
  }

  createEmptyBtn() {
    Widget body = HzyBtnWidget(
      text: LaunchIdConfig.find.tr,
      width: btnW,
      mainAxisSize: MainAxisSize.min,
      height: btnW,
      textStyle: HzyTextStyle.fontBold(
        size: 20,
        color: Colors.white,
      ),
      tapCall: tapCall,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(
          btnW,
        ),
        color: themeColor,
      ),
    );

    body = Stack(
      children: [
        WaterRipple(
          color: themeColor,
          count: count,
          size: Size(
            btnW * 2,
            btnW * 2,
          ),
        ),
        Positioned(
          left: btnW / 2,
          top: btnW / 2,
          child: body,
        ),
      ],
    );
    body = Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        body,
        RichText(
          text: TextSpan(
            style: HzyTextStyle.fontRegular(
              size: 12,
              color: HzyCommonColor().wbgblacktextcolor,
              height: 1.6,
            ),
            children: [
              TextSpan(text: LaunchIdConfig.updateToday.tr),
              TextSpan(
                text: " $randNum ",
                style: HzyTextStyle.fontBold(
                  size: 20,
                  color: themeColor,
                ),
              ),
              TextSpan(
                text: LaunchIdConfig.atlas.tr,
              ),
              TextSpan(
                text: "\n ${LaunchIdConfig.findQuick.tr}",
                style: HzyTextStyle.fontBold(
                  size: 14,
                ),
                recognizer: TapGestureRecognizer()..onTap = () => tapCall,
              )
            ],
          ),
          textAlign: TextAlign.center,
        ),
      ],
    );
    return body;
  }
}
